<template>
  <div class="blog-content">
    <div class="card">
      <van-card @click="detailContent(item)" v-for="item in result" :key="item.id" currency="⏲︎" :tag=item.heat
        :price=item.c_time :desc=item.description :title=item.title :thumb=item.picture>
        <template #tags>
          <van-tag plain type="primary">{{item.tag_type}}</van-tag>
        </template>
      </van-card>
    </div>
  </div>
</template>

<script setup>
import { reactive, ref } from 'vue';
import axios from '@/api/index.js'
import { onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { watch } from 'vue';
import { inject } from 'vue';



const router = useRouter()

const result = ref([])

const detail = ref([])

const props = defineProps({
  ishow: Array
})

if (props.ishow) {
  detail.value = props.ishow

}

// const parentMessage = inject('message');
// console.log(parentMessage);



console.log(props.ishow);



const date = new Date()


onMounted(async () => {
  const response = await axios.get('/blog/findAllNote')
  result.value = response.data
  // console.log(result);
})

// 跳转到详细的博客内容
const detailContent = (value) => {
  // console.log(value);
  router.push({ path: '/blogContentDetail', query: { id: value.id } })
}


</script>

<style lang="less" scoped>
.blog-content {
  padding-bottom: 50px;
}
</style>

<style lang="less">
.van-card__price {
  .van-card__price-currency {
    font-size: 14px;
  }

  .van-card__price-integer {
    font-size: 14px;
  }

  .van-card__price-integer:after {
    display: none;
  }

  #text {
    display: none;
  }
}
</style>

<style>
.blog-content {
  padding-bottom: 50px;
}

/* 在这里添加你的样式 */
.blog-content {
  padding: 20px;
  background-color: #f5f5f5;
}

.card {
  background-color: #ffffff;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
  overflow: hidden;
}

.card img {
  width: 100%;
  height: 100%;
}

.card h3 {
  font-size: 18px;
  margin: 10px 0;
}

.card p {
  font-size: 14px;
  color: #666666;
  line-height: 1.5;
}
</style>